from igraph import *
# g = Graph([(0,1),(0,2),(2,3),(3,4),(4,2)])
# Layout = g.layout('kk')

# # 添加3个点
# g.add_vertices(3)

# # 添加边
# g.add_edges([(0,1), (1,2), (4,5), (6,7)])

# plot(g,Layout = Layout)


g = Graph.GRG(100, 0.2) # 另一种算法生成图形
plot(g,layout="kk")

g.degree([2,3,4])     # 图的顶点度数计算
ecount = g.ecount()   # 统计边的数目
vcount = g.vcount()   # 统计节点数目

print(ecount)  
print(vcount)

edgelist = g.get_edgelist() # 打印边的连接信息
for edge in edgelist:
    print(edge)